package com.wtc.homework;
/**
 * 4.通过继承实现员工工资核算打印功能
 * 父类：员工类
 * 子类：部门经理类、普通员工类
 * （1）部门经理工资 = 1000+单日工资*天数*等级(1.2)
 * （2）普通员工工资 = 单日工资*天数*等级(1.0)
 * （3）员工属性：姓名，单日工资，工作天数
 * （4）员工方法(打印工资)
 * （5）普通员工及部门经理都是员工子类，需要重写打印工资方法。
 * （6）定义并初始化普通员工对象，调用打印工资方法输入工资，定义并初始化经理对象。调用打印工资方法输入工资。
 */
public class Homework04 {
    public static void main(String[] args) {
        Worker make = new Worker("make", 110, 10);
        System.out.println(make.input());
        Manger jack = new Manger("jack", 200, 10);
        System.out.println(jack.input());
    }
}
class Employee {
    private String name;
    private double sal;
    private double day;

    public String input() {
        return "姓名：" + name + "，单日工资：" + sal + "，工作天数：" + day;
    }

    public Employee(String name, double sal, double day) {
        this.name = name;
        this.sal = sal;
        this.day = day;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    public double getDay() {
        return day;
    }

    public void setDay(double day) {
        this.day = day;
    }
}
class Manger extends Employee {
    public Manger(String name, double sal, double day) {
        super(name, sal, day);
    }

    @Override
    public String input() {
        return super.input() + "，部门经理工资：" + (1000 + getSal() * getDay() * 1.2);
    }
}
class Worker extends Employee {
    public Worker(String name, double sal, double day) {
        super(name, sal, day);
    }

    @Override
    public String input() {
        return super.input() + "，普通员工工资：" + (getSal() * getDay());
    }
}